home *** CD-ROM | disk | FTP | other *** search
/ Pascal Super Library / Pascal Super Library (CW International)(1997).bin / SHELLS / SZ2 / ADEMO6.DEF < prev    next >
Text File  |  1992-08-31  |  4KB  |  82 lines

  1. .TUTORIAL - Using the [ DIALOG ] and [ HINT ] keywords
  2.  
  3. It's time to flesh out the editor a bit.  Let's add the standard
  4. Search & Replace dialogs.
  5.  
  6. The Dialog Editor is a screen painter.  You can open a file by
  7. pressing F3 and adding the ".DLG" file extension.  Or use the menu
  8. command, "RUN|Dialog Editor" or (Alt-D).
  9.  
  10. This lets you interactively compose dialogs to be used with the
  11. application.  The [ DIALOG ] keyword signals SHAZAM to generate
  12. dialogs (*.DLG) as code (*.SRC) or resources (*.REZ).
  13.  
  14. You can determine code or resources by using the SETUP|Code dialog,
  15. command-line switches, the [ SWITCH ] keyword or the [ DIALOG ] local
  16. override switch.
  17.  
  18. The dialogs used in this example and the library (..\DLG) were
  19. created with the Dialog Editor, and have hcXX symbols assigned.
  20. These symbols provide a "link" to Hint Text and Help Text.
  21.  
  22. *** IMPORTANT ***
  23. [X] When resources are used, the VALUE of an hcXX symbol is written
  24.     to the resource file (*.REZ).
  25.  
  26. [X] When code is generated, the TEXT for the hcXX symbol is written
  27.     to the source-code file (*.SRC).
  28.  
  29. When hand-coding, you MUST be aware of this!  A program and its
  30. resources can get "out of sync", such as after you edit & compile
  31. help text.  It can happen to cmXX values too, if you change them.
  32.  
  33. During the generate process, SHAZAM ensures updated values.  If you
  34. use the Dialog Editor to write a dialog to a resource file, load the
  35. Help Symbol file and use "EDIT|Help context|Update all".
  36.  
  37. *****************
  38.  
  39. In a definition, MenuBar and MenuBox elements have hint text on the
  40. same line as the SubMenu or Item, using the double semi-colon.  To
  41. create hints for other views, use the [ HINT ] keyword to name the
  42. hcXX symbol and add text after a double semi-colon.
  43.  
  44. Note that the hints use a naming convention, the result of which
  45. causes the hcXX symbols to be sorted and assigned a value in sort
  46. order.  This allows for how TCLUSTER assigns "HelpCtx" values; ie:
  47. The initial value is incremented by one for each additional element
  48. after the first (the only element using the directly assigned
  49. value).  See CLUSTER.DEF for a dedicated example of hints & TClusters.
  50.  
  51. Corresponding Help text is covered in the next example.
  52.  
  53. @PA - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  54.  
  55.  
  56.  
  57. [ UNIT ]
  58. General /r                                       @@ Use & register
  59.  
  60. [ DIALOG ]
  61. replace find                                    @@ *.DLG files
  62.  
  63. [ SUBMENU ] File             ;;file management
  64. %%open f3                    ;;open a file            @@ *.EVT file
  65. save   f2                    ;;save current window    @@ EDITORS.PAS internal
  66.  
  67. [ SUBMENU ] search           ;;text search-and-replace commands
  68. find...         ^QF          ;;search for text
  69. replace...      ^QA          ;;search for text and replace it with new text
  70. 'search again'   Ctrl-L      ;;repeat the last Find or Replace command
  71.  
  72.  
  73. [ HINT ]                     @@ "hc" prefix optional.  SHAZAM adds if needed.
  74. OK                           ;;accept the settings in this dialog box
  75. Cancel                       ;;close the dialog box without making any changes
  76. SearchText                   ;;Text to look for
  77. ReplaceText                  ;;Text to use for replace
  78. SearchType1                  ;;whether to consider case during search
  79. SearchType2                  ;;whether to consider partial matches
  80. SearchType3                  ;;whether to prompt before replacing
  81. SearchType4                  ;;whether to scan entire file
  82.